<?php
/*
 * File name : NewPledge.php
 * Description : Allows a Donor to subscribe to a new pledge based donation.
 * Created By : Pratibha Awasthi
 */

include_once "basePage.php";

class Pledge extends basePage{
	
	// Pledge based contribution toa fund
	public function donor_pledge(){
		    
			$con = mysql_connect('localhost','pa_user','secret_password');
			if (!$con){
		  		die('Could not connect: ' . mysql_error());
		  	}
		  
			mysql_select_db("TGS_GM_RESERVATION", $con);
			
			$result = mysql_query("SELECT * FROM TGS_GM_RESERVATION.lkpfrequency");
			
			$agencyresult = mysql_query("SELECT DISTINCT ID, Name FROM TGS_GM_RESERVATION.tblagency");
			
			// Enter all the required vales in the form
			
			echo <<<EPRINT
			<form action = "SignPledge" method = "post" name = "Pledge"> 
		   	 	
		   	 	<br/> <br/>
			 	<h3><br/> Enter the following details to signup for a Pledge Based Donation:  </h3>
			 	<br/> <br/>
				
			 	<table class = "frequency">
			 	
			 	<tr><td> Start Date :</td>
    			<td> <input type = 'text' name = 'start_date' value = ''> mm/dd/yyyy </td> </tr> 
    			
    			<tr><td> End Date :</td>
    			<td> <input type = 'text' name = 'end_date' value = ''> mm/dd/yyyy </td> </tr> 
    			
    			<tr><td> Amount :</td>
    			<td> <input type = 'text' name = 'amount' value = ''> $ </td> </tr> 
    			
			 	<tr><td>Frequency of Pledge Based Donation :</td>
			 	<td>
            	<select name="frequency">
    				<option value="0">Choose Frequency</option>
EPRINT;
    				while($row = mysql_fetch_array($result)){
    					echo <<<EPRINT
						<option> {$row['FrequencyType']} </option> 
EPRINT;
    				}
    				
    		echo <<<ESUBMIT
    			</select>
    			</td></tr>
    			
    			<tr><td>Agency :</td>
			 	<td>
            	<select name="agency">
    				<option value="0">Choose Agency</option>
ESUBMIT;
    				while($row = mysql_fetch_array($agencyresult)){
    					echo <<<EPRINT
						<option> {$row['Name']} </option> 
EPRINT;
    				}
    				
    		echo <<<ESUBMIT
    			</select>
    			</td></tr>
    			
    			</table>
				<p><br/><br/><input type = 'submit' name = 'submit' value = 'Back' onclick= 'history.go(-1);'>
				             <input type = 'submit' name = 'submit' value = 'Subscribe'></p>
				
				</form>    
ESUBMIT;
	
	}
}


$page = new Pledge();
$page->header();
$page->top_menu_donor();
$page->donor_pledge();
$page->footer();

?>